# -*- coding:utf-8 -*-
# @Time:2024/4/1921:01
# @Author:miuzg
# @FileName:new test2.py
# @Software:PyCharm
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()

url = 'https://www.baidu.com/'
driver.get(url)

# 根据id定位
driver.find_element(By.ID,'kw').send_keys('广东早茶')
driver.find_element(By.ID,'su').click()


url = 'http://www.cxy521.com/'
driver.get(url)
driver.maximize_window()

# 获取ID标签为pub-book的元素
print(driver.find_element(By.ID,'pub-book').text)

# 关闭浏览器
driver.quit()